Our obstacle avoidance algorithm is based on a predictive approach. Before going to the selected point, we try to determine if an obstacle would be on our path.The laser field of vision is limited as described in figure \ref{img_laserfov},  therefore if the angle between the robot and the goal point is outside of that area, the robot rotates to be aligned with the goal point before moving towards it. 
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.4]{img/laser_fov.jpg}
    \caption{Lasers field of vision}
    \label{img_laserfov}
\end{figure}

 Then we calculate for a range of angle, the theoretical distance to follow the path. That range is determined by lasers between X-axis of the robot and the angle between the robot and the goal point.  
 
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.4]{img/avoid_obstacle_schema.jpg}
    \caption{Obstacle avoidance schema}
    \label{img_obsavoid}
\end{figure}

Considering lasers in angle $a$. Each laser formed an angle $ai$ to the X-axis of the robot. The algorithm consists of computing distance $di$ for each angle $ai$. Each $di$ corresponds to an subtended chord of the circle which describes the next move of the robot. The length of such a chord is given by the following formula :

\begin{displaymath}
    di = 2r sin(\frac{ai}{2})
\end{displaymath}

 Then if the value of laser echoes  corresponding to the angle $ai$, which we will call $li$,  is inferior to the theoretical value $di$, it means an obstacle will be encountered. To avoid that case, our robot will go to the opposite direction, i.e rotate of an angle equals to $ai - \pi$ and go forward until it reaches a sufficient distance to preserve the theoretical distance, i.e. $di - li$ . Then another iteration of pure pursuit algorithm is executed.